<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/ext/core/ext/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/ext/core/extra/css/button.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/ext/core/extra/css/common.css" />
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/ext/core/ext/adapter/ext/ext-base.js"></script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/ext/core/ext/ext-all.js"></script>
		<script type="text/javascript">
			Ext.BLANK_IMAGE_URL = "<%=request.getContextPath()%>/ext/core/ext/resources/images/default/s.gif";
			Ext.onReady(function(){
   				var tree=new Ext.tree.TreePanel({
				     el:'tree-doc',
				     frame:true,
				     title:'A doc tree',
				     width:400,
				     //动态的加载数据URL 返回的必须是JSON
				     loader:new Ext.tree.TreeLoader({url:"cognos/loadTreeAction.do"}),
				    
				     autoScroll:true,//如果树的高超出这个树的面板 则自动显示滚动条
				     animate:true,//动态显示
				     enableDD:true,//支持拖放
				     // rootUIProvider: Ext.tree.CheckboxNodeUI,
				     selModel:new Ext.tree.CheckNodeMultiSelectionModel(),
				     containerScroll: true//这个不知道有什么用的
			   });
			     //AsyncTreeNode 会延迟加载没有展开的节点 认为凡是leaf不为true的都要延迟加载
			   var root=new Ext.tree.AsyncTreeNode({
			     text:'root',
			     draggable:false  //false表示这个节点将不能被拖拽
			    });
			   
			   tree.setRootNode(root);
			   //为树上的节点添加事件
			   tree.on('click',function(node){
			     Ext.Msg.alert('This node id is:',node.id);
			   });
			   
			   tree.render();
			   
			   root.expand(false,true);
			  
			});

		</script>

	</head>
	<body>
		<div id="tree-doc"></div>
	</body>
</html>



